Recent project requirements, need to write some shell script interaction, the pipeline is not enough time, expect can be very good to implement the interaction between the script, search for information, found that many articles on the Web are
expect is a process for interacting 's command. With expect, we can write the interactive process on a script so that it is done automatically. The image of the said, SSH login, FTP login and so on are consistent with the definition of interaction.
Expect detailed
The expect command is simply to implement tools that automatically interact in interactive software through its built-in commands.
SSH can be used in conjunction with the Spawn command to achieve automatic SSH login. And because it
Company recently to a batch of CDN server, need to change the password regularly, originally wanted to use automation tools to achieve this function, but recently busy no time to do, so the first way to modify the script, the Internet search for a
System: CentOS 6.x
1. Install expect first
The code is as follows
Copy Code
Yum-y Install expect
2. Script content:
The code is as follows
Copy Code
Cat
Preface
A period of time before the work of the machine replaced by Ubuntu + 128G SSD + 8G memory desktop, and finally embarked on the use of Linux Office Road, in general, Ubuntu is still more smoothly than I imagined, its "apt-get-style" package
Recently relatively busy, in the company wrote a Centreon+nagios platform source automatic installation script (because the company can not even outside the network, the company Yum source a lot of things are not all, so can only take the source
ObjectiveLearn about the knowledge reserves required for Shell script programming:Vi/vim Editor Command VIMRC set to be proficientBasic commands, more than 100 skilledBasic and common Network Service commands to be: NFS, rsync, INotify, Lanmp,
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.